import { Fragment } from '@/components/Fragment'; import { Divider, View, Flex, Text } from '@aws-amplify/ui-react'; import { DividerDemo } from './demo'; import { Example, ExampleCode } from '@/components/Example'; import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay'; import ThemeExample from '@/components/ThemeExample.mdx'; import { DefaultDividerExample, HorizontalDividerExample, VerticalDividerExample, DividerSizesExample, DividerStylePropsExample, DividerClassNameExample, DividerThemeExample, LabelExample, } from './examples'; ## Demo ## Usage Import the Divider component and place it between components you want separated. Most of the time you will want to use the divider in a [``](../components/flex) component. ```jsx file=./examples/DefaultDividerExample.tsx ``` ### Orientation **Horizontal (default)** ```jsx file=./examples/HorizontalDividerExample.tsx ``` **Vertical** ```jsx file=./examples/VerticalDividerExample.tsx ``` ### Sizes Available options are `small`, `large`, and none (default). ```jsx file=./examples/DividerSizesExample.tsx ``` ### Label ```jsx file=./examples/LabelExample.tsx ``` ## Customization ```tsx file=./examples/DividerThemeExample.tsx ``` ### CSS You can set the Amplify CSS variables or use the built-in `.amplify-divider` class to customize all Dividers in your application as well. ```css /* styles.css */ [data-amplify-theme] { --amplify-components-divider-border-style: dashed; } /* OR */ .amplify-divider { border-style: dashed; } ``` To replace _all_ the Divider styling, unset it: ```css .amplify-divider { all: unset; /* Add your styling here*/ } ``` ### Target classes ### Local styling To override styling on a specific Divider, you can use (in order of increasing specificity): a class selector, data attributes, or style props. _Using a class selector:_ ```jsx file=./examples/DividerClassNameExample.tsx ``` _Using style props:_ ```jsx file=./examples/DividerStylePropsExample.tsx ``` ### Default theme ```ts file=../../../../../../packages/ui/src/theme/tokens/components/divider.ts ```